package com.ebookstore.service.impl;

import com.ebookstore.service.BookService;
import com.ebookstore.service.CartService;
import com.ebookstore.service.EBookStoreFacade;
import com.ebookstore.service.OrderService;
import com.ebookstore.service.UserService;

public class EBookStoreImpl implements EBookStoreFacade {

	/** 定义图书服务对象 */
	private BookService bookService;

	/** 定义购物车服务对象 */
	private CartService cartService;

	/** 定义订单服务对象 */
	private OrderService orderService;

	/** 定义用户服务对象 */
	private UserService userService;

	public EBookStoreImpl() {
	}

	/** 获取图书服务对象 */
	public BookService getBookService() {
		if (bookService == null)
			bookService = new BookServiceImpl();
		return bookService;
	}

	/** 获取购物车服务对象 */
	public CartService getCartService() {
		if (cartService == null)
			cartService = new CartServiceImpl();
		return cartService;
	}

	/** 获取订单服务对象 */
	public OrderService getOrderService() {
		if (orderService == null)
			orderService = new OrderServiceImpl();
		return orderService;
	}

	/** 获取用户服务对象 */
	public UserService getUserService() {
		if (userService == null)
			userService = new UserServiceImpl();
//		System.out.println("ebookstoreImpl.getUserService():"+(userService==null));
		return userService;
	}

}
